package com.ming.interview;

import java.util.Scanner;

/**
 * @Description 有一分数序列：2/1，3/2，5/3，8/5，13/8，21/13…求出这个数列的前20项之和。
 * @Author ye.ming
 * @Date Created in 2019/8/26
 */
public class Main18 {

    public static void main(String[] args) {
        float up = 2, down = 1;
        float sum = 0;
        float temp = 0;
        for (int i = 0; i < 20; i++) {
            float fraction = up/down;
            sum += fraction;
            temp = up + down;
            down = up;
            up = temp;
        }

        System.out.println(sum);


    }


    private static void m1(int m, int n) {

    }


}
